package com.ktkj.init.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ktkj.init.utils.FileUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Attachment extends BaseEntity {

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;


    /**
     * 文件名称
     */
    private String fileName;

    /**
     * 路径
     */
    private String path;

    /**
     * 文件大小
     */
    private Long size;

    @TableField(exist = false)
    private String fileSize;

    public Long getSize() {
        fileSize = FileUtils.getFileSize(this.size);
        return size;
    }
}
